import time

import requests

def group_10(ehrid, headers_8,data,DOMAIN):
    try:
        dict_group_10 = {"个人主要健康问题":""}
        url_group_10 = f"{DOMAIN}/phis/app/hProblem?search_EQ_ehrId={ehrid}"
        response_10 = requests.post(url_group_10, data=data, headers=headers_8)

        list_gerenjiankang_big = []

        for i in response_10.json()["content"]:
            list_little = {}
            list_little["问题名称"] = i["problemName"]
            list_little["发生时间"] = i["startDate"]
            list_little["记录时间"] = i["recordDate"]
            list_little["接诊医生"] = i["referralDoctor"]
            list_little["备注"] = " "

            list_gerenjiankang_big.append(list_little)
        dict_group_10["个人主要健康问题"] = list_gerenjiankang_big
        if len(list_gerenjiankang_big)==0:
            dict_group_10["个人主要健康问题"] = "无"
    except:
        dict_group_10["个人主要健康问题"] = "解析有问题"
    print("问题没有在10",dict_group_10)
    return dict_group_10

if __name__ == '__main__':
    headers_8 = {
        "accept": "application/json",
        "accept-encoding": "gzip, deflate",
        "accept-language": "zh-CN,zh;q=0.9",
        "connection": "keep-alive",
        "content-length": "71",
        "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
        "cookie": "JSESSIONID=24BF068518B17EAE7414B0D2C6185CB1",
        "host": "10.216.11.24:8306",
        "origin": "http://10.216.11.24:8306",
        "referer": "http://10.216.11.24:8306/phis/app/ehr/update/1244783,,,false",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
        "x-requested-with": "XMLHttpRequest",
    }
    data = str(time.time()).replace(".", "")[0:13]
    dict_group_10 = group_10("d44928e0-fab7-4838-a15e-466a17d59650",headers_8,data = data,DOMAIN = "http://10.216.11.24:8306")
    print(dict_group_10)